﻿using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;

namespace QaaSimulation.QSim.Ships
{
    public abstract class QShipBox : QModelBox
    {
        protected int m_Crew;
        public int Crew
        {
            get
            {
                return m_Crew;
            }
            set
            {
                m_Crew = value;
            }
        }

        protected int m_Energy;
        public int Energy
        {
            get
            {
                return m_Energy;
            }
            set
            {
                m_Energy = value;
            }
        }

        protected QBoxSide m_ProhibitedNeighbors = QBoxSide.None;
        public QBoxSide ProhibitedNeighbors
        {
            get
            {
                return m_ProhibitedNeighbors;
            }
            set
            {
                m_ProhibitedNeighbors = value;
            }
        }

        public abstract Boolean CanBePlaced(QShipBox[] neighborhood);

        protected void PaintWalls(Graphics g)
        {
            QModelBox neighbor = GetNeighbor(QBoxSide.Top);
            Pen wallPen = Pens.Black;
            if (neighbor == null || neighbor.GetType() != this.GetType())
            {
                g.DrawLine(wallPen, 0, 0, QModelBox.BOX_RELATION, 0);
            }
            neighbor = GetNeighbor(QBoxSide.Bottom);
            if (neighbor == null || neighbor.GetType() != this.GetType())
            {
                g.DrawLine(wallPen, 0, QModelBox.BOX_RELATION, QModelBox.BOX_RELATION, QModelBox.BOX_RELATION );
            }

            neighbor = GetNeighbor(QBoxSide.Left);
            if (neighbor == null || neighbor.GetType() != this.GetType())
            {
                g.DrawLine(wallPen, 0, 0, 0, QModelBox.BOX_RELATION);
            }

            neighbor = GetNeighbor(QBoxSide.Right);
            if (neighbor == null || neighbor.GetType() != this.GetType())
            {
                g.DrawLine(wallPen, QModelBox.BOX_RELATION , 0, QModelBox.BOX_RELATION , QModelBox.BOX_RELATION);
            }
        }

        public override void Paint(Graphics g)
        {
            throw new NotImplementedException();
        }
    }

}
